home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / disp182a.zip / DRVSRC / CL5426.ASM < prev    next >
Assembly Source File  |  1993-12-06  |  12KB  |  386 lines

  1. ;--------------------------------------------------------------------------
  2. ; This is file CL5426.ASM
  3. ;
  4. ; Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  5. ; Copyright (C) 1992 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
  6. ; Copyright (C) 1993 Hartmut Schirmer, Feldstr. 118, 2300 Kiel 1, Germany
  7. ;
  8. ; This file is distributed under the terms listed in the document
  9. ; "copying.dj", available from DJ Delorie at the address above.
  10. ; A copy of "copying.dj" should accompany this file; if not, a copy
  11. ; should be available from where this file was obtained.  This file
  12. ; may not be distributed without a verbatim copy of "copying.dj".
  13. ;
  14. ; This file is distributed WITHOUT ANY WARRANTY; without even the implied
  15. ; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. ;--------------------------------------------------------------------------
  17. ;
  18. ; This driver supports Cirrus CL-GD542X Chipsets
  19. ; Check your BIOS documentation if all of below modes are supported !
  20. ;
  21. ; This is basically Hartmut's cirrus54 driver modified by Csaba Biegl.
  22. ; Changes:
  23. ;    1. Added 1280x1024 16 color mode
  24. ;    2. Changed 256 color modes to use fast scan line fills.
  25. ;
  26. include grdriver.inc
  27. cseg    segment byte public 'code'
  28.     assume  cs:cseg, ds:cseg, es:cseg, ss:nothing
  29.  
  30.  
  31. ;--------------------------------------------------------------------------
  32. ; DRIVER HEADER
  33. ;  The following entries MUST match the structure and constant
  34. ;  declarations in the file 'grdriver.h' of the GRX graphics library
  35. ;  The mode word should contain the following bitfields:
  36. ;     - the GRD_NEW_DRIVER bit set for any new format driver
  37. ;     - the adapter type field should be specified
  38. ;     - the memory size field should be specified
  39. ;     - the paging mode field should be specified
  40. ;  The mode set routine will OR in the plane bitfield as it will
  41. ;  change when different color number modes are requested.
  42. ;--------------------------------------------------------------------------
  43.  
  44.     dw    offset mode_set_routine
  45.     dw    offset paging_routine
  46. mode_W  dw    GRD_NEW_DRIVER+GRD_VGA+GRD_1024K+GRD_NO_RW
  47. ;
  48. ; The 'def_xx' fields are filled in by go32 from the corresponding
  49. ; fields of the 'GO32' environment variable
  50. ;
  51. def_tw  dw    80        ; text width
  52. def_th  dw    25        ; text height
  53. def_gw  dw    640        ; graphics width
  54. def_gh  dw    480        ; graphics height
  55. def_nc  dw    16        ; graphics colors
  56.     dw    offset driver_init_routine
  57.     dw    offset text_mode_table
  58.     dw    offset graphics_mode_table
  59.  
  60. ;
  61. ; Biggest text and graphics sizes
  62. ;
  63. Max_TW  equ    132
  64. Max_TH  equ    50
  65. Max_GWn equ    800        ; non interlaced!!!
  66. Max_GHn equ    600
  67. Max_GW  equ    1024        ; may be interlaced
  68. Max_GH  equ    768
  69.  
  70.  
  71. ;--------------------------------------------------------------------------
  72. ; TABLE OF SUPPORTED TEXT MODES
  73. ;    - keep sorted by size
  74. ;    - end with an all 0 entry
  75. ;    - BIOS field = 0xff disables it
  76. ;    - fields:
  77. ;        width,  height, colors, BIOS#+  setup_procedure_index*256
  78. ;--------------------------------------------------------------------------
  79. text_mode_table        label word
  80.     dw    80,    25,    2,    007h +  00000h
  81.     dw    40,    25,    16,    001h +  00000h
  82.     dw    80,    25,    16,    003h +  00000h
  83.     dw    80,    50,    16,    003h +  00100h
  84.     dw    132,    25,    16,    014h +  00000h
  85.     dw    132,    43,    16,    054h +  00000h
  86.     dw    0,    0,    0,    000h +  00000h
  87.  
  88.  
  89. ;--------------------------------------------------------------------------
  90. ; TABLE OF SUPPORTED GRAPHICS MODES
  91. ;    - keep sorted first by colors then by size
  92. ;    - end with an all 0 entry
  93. ;    - BIOS field = 0xff disables it
  94. ;    - fields:
  95. ;        width,  height, colors, BIOS#+  setup_procedure_index*256
  96. ;--------------------------------------------------------------------------
  97. graphics_mode_table    label word
  98.     dw    320,    200,    16,    00dh +  00000h
  99.     dw    640,    200,    16,    00eh +  00000h
  100.     dw    640,    350,    16,    010h +  00000h
  101.     dw    640,    480,    16,    012h +  00000h
  102.     dw    800,    600,    16,    058h +  00000h
  103.     dw    1024,    768,    16,    05dh +  00000h
  104.     dw    1280,  1024,    16,    06ch +  00000h
  105.     dw    320,    200,    256,    013h +  00000h
  106.     dw    640,    480,    256,    05fh +  00000h
  107.     dw    800,    600,    256,    05ch +  00000h
  108.     dw    1024,    768,    256,    060h +  00000h
  109.     dw    640,    480,  32768,    066h +  00000h
  110.     dw    800,    600,  32768,    067h +  00000h
  111.     dw    0,      0,      0,    000h +  00000h
  112.  
  113.  
  114. ;--------------------------------------------------------------------------
  115. ; TABLE OF SPECIAL SETUP PROCEDURES
  116. ;  You may need such procedures for:
  117. ;     -- reloading fonts on standard EGA or VGA for
  118. ;     higher resolution text modes
  119. ;     -- enable HiColor mode of some Super VGAs
  120. ;     -- Handle the parameter passing conventions of the VESA BIOS
  121. ;     -- put VGA into 256 color plane mode ("MODE X")
  122. ;     -- etc...
  123. ;  There should be one entry in the table for every non-zero
  124. ;  'setup_procedure_index' in the text and graphics mode tables.
  125. ;  The first entry in the table belongs to index 100h, and so on.
  126. ;  The special setup procedure is invoked via a near call.
  127. ;
  128. ;  Entry: DI=address of the mode record from the text or graphics
  129. ;      table to set up.
  130. ;
  131. ;  Exit:  Adapter configured
  132. ;      BX=driver mode word as it should be returned by the mode set
  133. ;         routine. Typically it involves picking up the mode word
  134. ;         from the header and OR-ing in the appropriate bitplane mode
  135. ;         bitfield. (This is not needed for text modes)
  136. ;      AX, CX, DX, SI can be trashed, PRESERVE DI!!!!
  137. ;
  138. ;  NOTE: This runs in real mode, but don't mess with the segment registers.
  139. ;--------------------------------------------------------------------------
  140. special_setup_table    label word
  141.     dw    offset  VGA_50row_mode_set
  142.  
  143. ;
  144. ; Routine to set up VGA 50 row mode
  145. ; interface is described above
  146. ;
  147. VGA_50row_mode_set    proc    near
  148.     mov    ax,03h            ; set 80x25 mode
  149.     int    10h
  150.     xor    bx,bx
  151.     mov    ax,1112h        ; load 8x8 font
  152.     int    10h
  153.     ret
  154. VGA_50row_mode_set    endp
  155.  
  156.  
  157. ;--------------------------------------------------------------------------
  158. ; DRIVER INIT ROUTINE
  159. ;  called once after the driver is loaded
  160. ;  may do one or more of the followings:
  161. ;    - check for proper board type
  162. ;    - check amount of RAM on board, and:
  163. ;    -- update word in header to reflect correct amount
  164. ;    -- disable modes in the tables for which there is not enough RAM
  165. ;    - check for special equipment (HiColor DAC, etc...)
  166. ;
  167. ;  Entry: nothing
  168. ;
  169. ;  Exit:  AX=status:
  170. ;       non-zero: OK,
  171. ;       0: something went wrong (e.g. wrong adapter, etc..)
  172. ;      BX,CX,DX may be trashed
  173. ;
  174. ;  NOTE: This runs in real mode, but don't mess with the segment registers.
  175. ;--------------------------------------------------------------------------
  176. driver_init_routine    proc    far
  177.     mov    ax,1            ; Really primitive, but works
  178.     ret                ; Make sure you've an GD542X Chip !
  179. driver_init_routine    endp
  180.  
  181.  
  182. ;--------------------------------------------------------------------------
  183. ; MODE SET ROUTINE
  184. ;  sets up a text or graphics mode as close as possible to the one
  185. ;  reguested by the user with regard to number of colors and size.
  186. ;
  187. ;  Entry: AX=mode selection
  188. ;     0 = 80x25 text
  189. ;     1 = default text
  190. ;     2 = text CX cols by DX rows
  191. ;     3 = biggest text
  192. ;     4 = 320x200 graphics
  193. ;     5 = default graphics
  194. ;     6 = graphics CX width by DX height
  195. ;     7 = biggest non-interlaced graphics
  196. ;     8 = biggest graphics
  197. ;     9 = graphics BX colors, CX width by DX height
  198. ;
  199. ;  Exit: BX=driver mode flag
  200. ;     CX=width (in pixels or characters)
  201. ;     DX=height
  202. ;
  203. ;  NOTE: This runs in real mode, but don't mess with the segment registers.
  204. ;     YOU SHOULD NOT NEED TO CHANGE THIS ROUTINE AS IT IS PRETTY
  205. ;     MUCH TABLE DRIVEN
  206. ;--------------------------------------------------------------------------
  207. mode_set_routine    proc    far
  208.     push    ds
  209.     push    di
  210.     push    si
  211.     mov    si,cs
  212.     mov    ds,si
  213.     cmp    ax,9
  214.     jbe    DoIt
  215.     jmp    Exit
  216. DoIt:    add    ax,ax
  217.     mov    si,ax
  218.     jmp    WORD PTR mode_set_table[si]
  219. mode_set_table  label    word
  220.     dw    offset mode_0
  221.     dw    offset mode_1
  222.     dw    offset mode_2
  223.     dw    offset mode_3
  224.     dw    offset mode_4
  225.     dw    offset mode_5
  226.     dw    offset mode_6
  227.     dw    offset mode_7
  228.     dw    offset mode_8
  229.     dw    offset mode_9
  230. mode_0: mov    si,offset text_mode_table    ; 80x25 text
  231.     mov    bx,def_nc
  232.     mov    cx,80
  233.     mov    dx,25
  234.     jmp    Lookup
  235. mode_1: mov    si,offset text_mode_table    ; default text
  236.     mov    bx,def_nc
  237.     mov    cx,def_tw
  238.     mov    dx,d